package com.neusoft.neuiotms.dcom.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.TeamUserDTO;
import com.neusoft.neuiotms.dcom.model.TeamUser;

@Component
public class TeamUserConverter extends AbstractConverter<TeamUser, TeamUserDTO> {

    @Override
    public TeamUser toModel(final TeamUserDTO dto) {

        final TeamUser model = new TeamUser();

        model.setCode(dto.getCode());
        model.setName(dto.getName());
        model.setIsManager(dto.getIsManager());

        return model;
    }

    @Override
    public TeamUserDTO toDTO(final TeamUser model, final boolean forListView) {

        final TeamUserDTO dto = new TeamUserDTO();

        dto.setId(model.getId());
        dto.setCode(model.getCode());
        dto.setName(model.getName());
        dto.setIsManager(model.getIsManager());

        return dto;
    }

}
